package matlap.client.view.student;

import matlap.client.services.student.StudentService;
import matlap.client.services.student.StudentServiceAsync;
import matlap.shared.Student;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;

public class MyScoresComposite extends Composite {

	StudentServiceAsync c1 = GWT.create(StudentService.class);
	private Grid g2;
	private VerticalPanel vp;
	protected String name;
	private String who;

	public MyScoresComposite(String w) {
		who = w;
		init();

		c1.getStudentByUserName(who, new AsyncCallback<Student>() {

			@Override
			public void onFailure(Throwable caught) {
				Window.alert("Database Student Problem In MyScores");

			}

			@Override
			public void onSuccess(Student result) {
				// TODO Auto-generated method stub

				for (int j = 0; j < 10; j++) {
					g2.setText(1, j, " " + result.getScores(j));
				}

			}

		});

	}

	private void init() {
		vp = new VerticalPanel();
		initWidget(vp);

		g2 = new Grid(2, 10);
		g2.setBorderWidth(2);
	
		Label lb0 = new Label(" Szeptember   ");
		lb0.setStyleName("Header");
		g2.setWidget(0, 0, lb0);

		Label lb1 = new Label(" Okt\u00F3ber   ");
		lb1.setStyleName("Header");
		g2.setWidget(0, 1, lb1);
		
		Label lb2 = new Label(" November   ");
		lb2.setStyleName("Header");
		g2.setWidget(0, 2, lb2);
		
		Label lb3 = new Label(" December   ");
		lb3.setStyleName("Header");
		g2.setWidget(0, 3, lb3);
		
		Label lb4 = new Label(" Janu\u00E1r   ");
		lb4.setStyleName("Header");
		g2.setWidget(0, 4, lb4);
		
		Label lb5 = new Label(" Febru\u00E1r   ");
		lb5.setStyleName("Header");
		g2.setWidget(0, 5, lb5);
		
		Label lb6 = new Label(" M\u00E1rcius   ");
		lb6.setStyleName("Header");
		g2.setWidget(0, 6, lb6);
		
		Label lb7 = new Label(" \u00C1prilis   ");
		lb7.setStyleName("Header");
		g2.setWidget(0, 7, lb7);
		
		Label lb8 = new Label(" M\u00E1jus   ");
		lb8.setStyleName("Header");
		g2.setWidget(0, 8, lb8);
		
		Label lb9 = new Label(" J\u00FAnius   ");
		lb9.setStyleName("Header");
		g2.setWidget(0, 9, lb9);
		
		vp.add(g2);

	}
}
